import {
  post,
  get,
  put,
  dalete,
  postJosn,
  putone,
  patch,
  daleteJson
} from '../utils/request';

//查询组织机构2
export function getOrgTreeQuery(data) {
 return get("/api/user-service/v1/organization/getOrgTreeQuery", data);
}
//查询组织机构
export function getmemberorg(data) {
  return get('/api/user-service/v1/organization/getOrgTree', data);
}

/**
 * @description: 区域移动
 * @param {Number} type 请求类型，3 为大区移动，4 为店铺移动  --> 与移动的层级保持一致
 * @param {Object} data 请求参数
 * @return {Promise}
 */
export function areaMove(type, data) {
  const requestUrl = `/api/user-service/v1/organization/${ type == 3 ? 'modifyOrganizationalStructureByRegion' : 'modifyOrganizationalStructure' }`;
  return put(requestUrl, data);
}

//新增组织机构
export function addmemberorg(data) {
  return post('/api/user-service/v1/organization/createOrganization', data);
}

//删除组织机构
export function deleteorg(data) {
  return dalete('/api/user-service/v1/organization/deleteOrganization', data);
}

//删除组织机构
export function updaterole(data) {
  return put('/api/user-service/v1/organization/modifyOrganization', data);
}

//5.3.57　采购需求单创建
export function addRequirement(data) {
  return post('/v1/purchase/makePurchaseRequirement', data);
}
//5.3.57　采购需求单修改
export function modifyPurchaseRequirement(data) {
  return put('/v1/purchase/modifyPurchaseRequirement', data);
}
//5.3.57　采购需求单明细查询
export function Requirementinfo(data) {
  return get('/v1/purchase/queryPurchaseRequirementById', data);
}
//5.3.57　组织类型
export function getUserOrgType(data) {
  return post('/api/user-service/v1/user/getUserOrgType', data);
}
